var hhckParam={};
var smrz_app = function(){
	function urlToIframe(){
		var smrzRactive = new Ractive({
			el : ".mainDiv",
			template : "#main-template",
			data : {
				"hzfmc":manager.findParamFromUrl("hzfmc"),
				"tjsj":manager.findParamFromUrl("tjsj")
			},
			onrender : function(){
			},
			oncomplete : function(){
				
				if($("#content").hasClass("none")){
					$("#content").removeClass("none");
				}
				$.get("../../tpl/xysq.html", function(template) {
					smrzRactive.set("qyxycontent",template);
					
				});
				

				
			}
		});
		
		
		
		
		smrzRactive.on({
			tysh : function() {
				var fn_confirm = function(){
					$("#btn_shtg").attr("disabled", true);
					//$("#btn_shth").attr("disabled", true);
					//审批结果(0-同意 1-拒绝)
					var param={};
					param.id=manager.findParamFromUrl("id");
					param.spjg="0";
					
					$.ajax({
						url : Constants.amUrlPath+ "hzfgl/updateHzfXyzt",
						type : "POST",
						dataType : "json",
						contentType : "application/json",
						data:JSON.stringify(param),
						success : function(obj) {
							 $("#btn_shtg").removeAttr("disabled");
							  if(obj.result){
									var objs3 = {
											txt : "审核成功！",
											callBackFun : function() {
											}
										};
										success(objs3);
							  }else{
								  if(obj.errorList!=null&&obj.errorList.length>0){
										manager.errorMsg(obj);
										return;
									}
								  alert("审核失败！","提示");
							  }
						
						}
					});
				};
			  	var objs1={
	        			txt:"确认通过审核吗？",
	        			successCallBackFun:fn_confirm
	        	}
	        	confirm(objs1);
	
				
				
			},
			shth:function(){
				$("#btn_shth").attr("disabled", true);
				$("#btn_shtg").attr("disabled", true);
				var param={};
				param.id=manager.findParamFromUrl("id");
				//审批结果(0-同意 1-拒绝)
				param.spjg="1";
				
				$.ajax({
					url : Constants.amUrlPath+ "hzfgl/updateHzfXyzt",
					type : "POST",
					dataType : "json",
					contentType : "application/json",
					data:JSON.stringify(param),
					success : function(obj) {
						  if(obj.result){
								var objs3 = {
									txt : "审核成功！",
									callBackFun : function() {
									}
								}
								success(objs3);
						  }else{
							  alert("审核失败！","提示");
						  }
					
					}
				});
				
			}
		});
		
		}
	
	//获取url参数
	function getUrlParam(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if(r != null) return decodeURI(r[2]);
		return null;
	}
	return {
		init: function(){
			urlToIframe();
		}
	}
}()
$(document).ready(smrz_app.init);